{% extends 'dns_manager/base.html' %}
{% load crispy_forms_tags %}

{% block title %}添加域名 - DNS管理系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-lg-8">
        <div class="card border-0 shadow-sm">
            <div class="card-header bg-success text-white">
                <h4 class="mb-0">
                    <i class="bi bi-globe-americas me-2"></i>添加域名
                </h4>
            </div>
            
            <div class="card-body p-4">
                <form method="post">
                    {% csrf_token %}
                    
                    <div class="row g-3">
                        <div class="col-12">
                            <label class="form-label fw-semibold">域名 *</label>
                            {{ form.name }}
                            {% if form.name.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.name.errors.0 }}
                                </div>
                            {% endif %}
                            <small class="form-text text-muted">
                                请输入完整的域名，如：example.com
                            </small>
                        </div>
                        
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">云账号 *</label>
                            {{ form.cloud_account }}
                            {% if form.cloud_account.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.cloud_account.errors.0 }}
                                </div>
                            {% endif %}
                        </div>
                        
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">Zone ID</label>
                            {{ form.zone_id }}
                            {% if form.zone_id.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.zone_id.errors.0 }}
                                </div>
                            {% endif %}
                            <small class="form-text text-muted">
                                可选，部分云服务商需要
                            </small>
                        </div>
                        
                        <div class="col-12">
                            <div class="form-check">
                                {{ form.is_active }}
                                <label class="form-check-label fw-semibold" for="{{ form.is_active.id_for_label }}">
                                    启用此域名
                                </label>
                            </div>
                        </div>
                    </div>
                    
                    <hr class="my-4">
                    
                    <div class="d-flex gap-2">
                        <button type="submit" class="btn btn-success">
                            <i class="bi bi-check me-1"></i>保存域名
                        </button>
                        <a href="{% url 'domains' %}" class="btn btn-outline-secondary">
                            <i class="bi bi-x me-1"></i>取消
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}